package com.gxuwz.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
@Slf4j
public class PageController {
    @RequestMapping("/loginHome")
    public String loginHome(){
        return "login";
    }

    @RequestMapping("/register")
    public String register(){
        return "register";
    }

    @RequestMapping("/home")
    public String home(){
        return "home";
    }

    /**
     * @Description:实现用户退出登录功能
     * @Param:  [javax.servlet.http.HttpServletRequest]
     * @Return: java.lang.String
     */

    @RequestMapping("/outLogin")
    public String outLogin(HttpServletRequest request){
        HttpSession session = request.getSession();
        session.removeAttribute("username");
        return "login";
    }

}
